import Vue from 'vue'
import './cube-ui'
import App from './App.vue'
import 'amfe-flexible'
import router from './router'
import request from './util/request';
import 'animate.css';
import './fonts/iconfont.js';
import {iLocal} from "./util/cache";
import store from './store'

Vue.config.productionTip = false
Vue.prototype.$iLocal = iLocal;
Vue.prototype.$sysinfo = window.sysinfo;
Vue.prototype.$url = request;
if(process.env.NODE_ENV === 'production') Vue.prototype.$wx = window.wx

/**
 * 隐藏微信目录
 */
if(window.wx){
  window.wx.ready(()=>{
    window.wx.hideMenuItems({
      menuList:['menuItem:share:QZone','menuItem:share:facebook','menuItem:share:weiboApp','menuItem:share:qq','menuItem:copyUrl','menuItem:originPage','menuItem:readMode','menuItem:openWithQQBrowser','menuItem:openWithSafari','menuItem:share:email']
    });
  });
}

router.beforeEach((to,from,next)=>{
  //页面名称
  switch(to.name){
    case "index":
      document.title = window.sysinfo.web_name;
      break;
    default:
      document.title = to.meta.title;
      break;
  }
  next();
});


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')


router.afterEach(()=>{
  setTimeout(()=>{
    window.scroll(0,0);
  },100);
});


